package com.mimiwang.oss.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @AUTHOR:游李滨
 * @DATE:2022/10/2 21:01
 */

@ConfigurationProperties(prefix = "oss")
@Component
@Data
public class OssConfiguration {


    public  String bucketName="mimiwang" ;

    public  String defaultDir="image";


    public  String endpoint = "oss-cn-chengdu.aliyuncs.com";
    // 阿里云账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维，请登录RAM控制台创建RAM用户。
    public  String accessKeyId = "LTAI5t6Grt5FSKzSKJVvpZkt";
    public  String accessKeySecret = "pKp6jZe6WiO7DBQS6PDbCdwcMXor01";

    @Bean
    public OSS ossClient(){
        return  new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}
